import Vue from 'vue'
import VueRouter from 'vue-router'
import LayoutComponent from '@/views/LayoutComponent'
import LoginComponent from '@/views/LoginComponent'
import FindHouse from '@/views/FindHouse'
import MainComponent from '@/views/MainComponent'
import MessageComponent from '@/views/MessageComponent'
import UserComponent from '@/views/UserComponent'
import CityComponent from '@/views/CityComponent'
import MyCollect from '@/views/MyCollect'
import MyHouses from '@/views/MyHouses'
import MapFindHouse from '@/views/MapFindHouse'
import GoRent from '@/views/GoRent'
import AddRent from '@/views/AddRent'
import SearchCommunity from '@/views/SearchCommunity'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: LayoutComponent,
    redirect: '/main',
    children: [{ path: '/house', component: FindHouse }, { path: '/message', component: MessageComponent }, { path: '/main', name: 'main', component: MainComponent }, { path: '/user', component: UserComponent }]
  },
  {
    path: '/login',
    component: LoginComponent
  },
  {
    path: '/city',
    name: 'city',
    component: CityComponent
  },
  {
    path: '/collect',
    component: MyCollect
  },
  {
    path: '/houses',
    component: MyHouses
  },
  {
    path: '/map',
    component: MapFindHouse
  },
  {
    path: '/rent',
    component: GoRent,
    redirect: '/rent/add',
    children: [{ path: '/rent/search', component: SearchCommunity }, { path: '/rent/add', component: AddRent }]
  }

]

const router = new VueRouter({
  routes
})

export default router
